# INFIX OPERATORS

Infix operators provide convenient ways to perform type casting, pattern matching, and value comparisons directly within queries. These operators include cast (`::`), `IN`, `LIKE`, `RLIKE`, and match (`:`).

## Syntax

`<expression> :: <type>`
`<expression> IN (<value1>, <value2>, ...)`
`<expression> LIKE <pattern or patterns>`
`<expression> RLIKE <pattern or patterns>`
`<field> : <query>`

### Parameters

#### Cast (`::`)

Provides an alternative syntax for type conversion, allowing you to cast values to a specific type.

#### IN

Tests whether a field or expression equals any element in a list of literals, fields, or expressions.

#### LIKE

Filters data based on string patterns using wildcards. The left-hand side is typically a field or literal, and the right-hand side is the pattern. Supports `*` (zero or more characters) and `?` (one character) wildcards. Patterns can be single or multiple, and escaping is supported using backslash `\` or triple quotes `"""`.

#### RLIKE

Filters data using regular expression patterns. The left-hand side is typically a field or literal, and the right-hand side is the regex pattern. Supports single or multiple patterns, and escaping is supported using backslash `\` or triple quotes `"""`.

#### Match (`:`)

Performs a match query on the specified field, returning true if the provided query matches the row. Equivalent to the match function.

## Examples

Concatenates a version string by casting and combining values, then casting the result to a VERSION type.
```esql
ROW ver = CONCAT(("0"::INT + 1)::STRING, ".2.3")::VERSION
```

Checks if the result of subtracting `a` from `c` is present in a list of values, including literals and expressions.
```esql
ROW a = 1, b = 4, c = 3
| WHERE c-a IN (3, b / 2, a)
```

Filters employees whose first name matches the pattern `?b*`, where `?` is any single character and `*` is any sequence of characters.
```esql
FROM employees
| WHERE first_name LIKE """?b*"""
| KEEP first_name, last_name
```

Matches the string "foo * bar" by escaping the `*` character in the pattern.
```esql
ROW message = "foo * bar"
| WHERE message LIKE "foo \\* bar"
```

Matches the string "foo * bar" using triple quotes to simplify escaping of the `*` character.
```esql
ROW message = "foo * bar"
| WHERE message LIKE """foo \* bar"""
```

Returns true if the `message` field matches any of the patterns "foo*" or "bar?".
```esql
ROW message = "foobar"
| WHERE message like ("foo*", "bar?")
```

Filters employees using a pattern provided as a query parameter for the `first_name` field.
```esql
FROM employees
| WHERE first_name LIKE ?pattern
| KEEP first_name, last_name
```

Filters employees whose first name matches the regular expression `.leja.*`.
```esql
FROM employees
| WHERE first_name RLIKE """.leja.*"""
| KEEP first_name, last_name
```

Matches the string "foo ( bar" by escaping the `(` character in the regex pattern.
```esql
ROW message = "foo ( bar"
| WHERE message RLIKE "foo \\( bar"
```

Matches the string "foo ( bar" using triple quotes to simplify escaping of the `(` character in the regex pattern.
```esql
ROW message = "foo ( bar"
| WHERE message RLIKE """foo \( bar"""
```

Returns true if the `message` field matches any of the regex patterns "foo.*" or "bar.".
```esql
ROW message = "foobar"
| WHERE message RLIKE ("foo.*", "bar.")
```

Filters employees using a regex pattern provided as a query parameter for the `first_name` field.
```esql
FROM employees
| WHERE first_name RLIKE ?pattern
| KEEP first_name, last_name
```

Filters books where the `author` field matches the value "Faulkner".
```esql
FROM books
| WHERE author:"Faulkner"
```